package 第1节循环语句;

public class LianXi03 {
    public static void main(String[] args) {
        /*
           k    i   j
    *     -4    1   1
   * *    -3    2   1 2
  * * *   -2    3   1 2 3
 * * * *  -1    4   1 2 3 4
* * * * *  0    5   1 2 3 4 5   j <= i
 * * * *   1    6   1 2 3 4
  * * *    2    7   1 2 3
   * *     3    8   1 2
    *      4    9   1           j <= 10 - i
    j <= i && j <= 10 - i
        */
        for (int i = 1; i <= 9; i++) {
            for (int k = 1; k <= Math.abs(i - 5); k++) {
                System.out.print(" ");
            }
            for (int j = 1;j <= i && j <= 10 - i;j++) {
                System.out.print("*" + " ");
            }
            System.out.println();
        }
    }
}
